Hi all, |
Re: OleAutoObj and "Object Text"
Without example code, it is hard to say why it fails, but did you maybe forget to cast to the "Object Text" to string ?
// not like this!
// olePut (objShape, "Text", obj."Object Text" )
// cast to string, by appending an empty string.
olePut(objShape, "Text", obj."Object Text" "")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: OleAutoObj and "Object Text" Mathias Mamsch - Fri Jul 30 06:01:55 EDT 2010
Without example code, it is hard to say why it fails, but did you maybe forget to cast to the "Object Text" to string ?
// not like this!
// olePut (objShape, "Text", obj."Object Text" )
// cast to string, by appending an empty string.
olePut(objShape, "Text", obj."Object Text" "")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Hello Mathias!,
OleAutoObj getShape(string name){
//Create variables
string str = ""
int flag = 0
int i = 1
//Grab shapes
oleGet(objSheet, cPropertyShapes, objShapes)
if(null objShapes) {print "No shapes collection found ...\n"; halt;}
//Create argument
OleAutoArgs autoArgs = create
while(flag = 0){
put(autoArgs, i)
//Get individual shape
oleMethod(objShapes, cMethodItem, autoArgs, objShape)
if(null objShape){ print "Cannot find shape ...\n"; halt;}
//Get name
oleGet(objShape, cPropertyName, str)
if(name == str){ flag = 1;}
else {i = i + 1;}
//Clear args
clear(autoArgs)
}
//Return shape object
return objShape
}
OleAutoObj objShape = getShape("MyPicture")
|
Re: OleAutoObj and "Object Text" meherts - Fri Jul 30 09:37:21 EDT 2010
Hello Mathias!,
OleAutoObj getShape(string name){
//Create variables
string str = ""
int flag = 0
int i = 1
//Grab shapes
oleGet(objSheet, cPropertyShapes, objShapes)
if(null objShapes) {print "No shapes collection found ...\n"; halt;}
//Create argument
OleAutoArgs autoArgs = create
while(flag = 0){
put(autoArgs, i)
//Get individual shape
oleMethod(objShapes, cMethodItem, autoArgs, objShape)
if(null objShape){ print "Cannot find shape ...\n"; halt;}
//Get name
oleGet(objShape, cPropertyName, str)
if(name == str){ flag = 1;}
else {i = i + 1;}
//Clear args
clear(autoArgs)
}
//Return shape object
return objShape
}
OleAutoObj objShape = getShape("MyPicture")
You just need to use the "Copy" method on the shape object and do an olePaste(Attr_) to the attribute you want to import into. I don't know if there is a way without using the clipboard. You can convert an EmbeddedOleObject into an OleAutoObj but I think it is not possible the other way around. You can also use this approach to create OLE objects from scratch, for example an excel chart or a visio diagram. This is most useful for generating reports in DOORS.
OleAutoObj objEx = oleGetAutoObject("Excel.Application")
if (null objEx) { print "Please open Excel!"; halt }
OleAutoObj objSheet = null
oleGet(objEx, "ActiveSheet", objSheet)
if (null objEx) { print "Cannot find sheet. Please open a workbook!"; halt }
string s
oleGet(objSheet, "Name", s)
print "Worksheet Name: " s "\n"
OleAutoObj objShapes
oleGet(objSheet, "Shapes", objShapes)
if (null objShapes) { print "That is weird. No shapes collection found ..."; halt }
OleAutoArgs args = create()
put(args, 1)
OleAutoObj objShape
oleMethod(objShapes, "Item", args, objShape)
if (null objShape) { print "Cannot find Shape. Please insert a clipart to the active worksheet!"; halt }
oleGet(objShape, "Name", s)
print "Picture Name: " s "\n"
print oleMethod(objShape, "Copy")
olePaste (current Object)."Object Text"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: OleAutoObj and "Object Text" meherts - Fri Jul 30 09:37:21 EDT 2010
Hello Mathias!,
OleAutoObj getShape(string name){
//Create variables
string str = ""
int flag = 0
int i = 1
//Grab shapes
oleGet(objSheet, cPropertyShapes, objShapes)
if(null objShapes) {print "No shapes collection found ...\n"; halt;}
//Create argument
OleAutoArgs autoArgs = create
while(flag = 0){
put(autoArgs, i)
//Get individual shape
oleMethod(objShapes, cMethodItem, autoArgs, objShape)
if(null objShape){ print "Cannot find shape ...\n"; halt;}
//Get name
oleGet(objShape, cPropertyName, str)
if(name == str){ flag = 1;}
else {i = i + 1;}
//Clear args
clear(autoArgs)
}
//Return shape object
return objShape
}
OleAutoObj objShape = getShape("MyPicture")
You just need to use the "Copy" method on the shape object and do an olePaste(Attr_) to the attribute you want to import into. I don't know if there is a way without using the clipboard. You can convert an EmbeddedOleObject into an OleAutoObj but I think it is not possible the other way around. You can also use this approach to create OLE objects from scratch, for example an excel chart or a visio diagram. This is most useful for generating reports in DOORS.
OleAutoObj objEx = oleGetAutoObject("Excel.Application")
if (null objEx) { print "Please open Excel!"; halt }
OleAutoObj objSheet = null
oleGet(objEx, "ActiveSheet", objSheet)
if (null objEx) { print "Cannot find sheet. Please open a workbook!"; halt }
string s
oleGet(objSheet, "Name", s)
print "Worksheet Name: " s "\n"
OleAutoObj objShapes
oleGet(objSheet, "Shapes", objShapes)
if (null objShapes) { print "That is weird. No shapes collection found ..."; halt }
OleAutoArgs args = create()
put(args, 1)
OleAutoObj objShape
oleMethod(objShapes, "Item", args, objShape)
if (null objShape) { print "Cannot find Shape. Please insert a clipart to the active worksheet!"; halt }
oleGet(objShape, "Name", s)
print "Picture Name: " s "\n"
print oleMethod(objShape, "Copy")
olePaste (current Object)."Object Text"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: OleAutoObj and "Object Text" Mathias Mamsch - Sun Aug 01 05:57:24 EDT 2010
You just need to use the "Copy" method on the shape object and do an olePaste(Attr_) to the attribute you want to import into. I don't know if there is a way without using the clipboard. You can convert an EmbeddedOleObject into an OleAutoObj but I think it is not possible the other way around. You can also use this approach to create OLE objects from scratch, for example an excel chart or a visio diagram. This is most useful for generating reports in DOORS.
OleAutoObj objEx = oleGetAutoObject("Excel.Application")
if (null objEx) { print "Please open Excel!"; halt }
OleAutoObj objSheet = null
oleGet(objEx, "ActiveSheet", objSheet)
if (null objEx) { print "Cannot find sheet. Please open a workbook!"; halt }
string s
oleGet(objSheet, "Name", s)
print "Worksheet Name: " s "\n"
OleAutoObj objShapes
oleGet(objSheet, "Shapes", objShapes)
if (null objShapes) { print "That is weird. No shapes collection found ..."; halt }
OleAutoArgs args = create()
put(args, 1)
OleAutoObj objShape
oleMethod(objShapes, "Item", args, objShape)
if (null objShape) { print "Cannot find Shape. Please insert a clipart to the active worksheet!"; halt }
oleGet(objShape, "Name", s)
print "Picture Name: " s "\n"
print oleMethod(objShape, "Copy")
olePaste (current Object)."Object Text"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thank you once again, Mark |
Re: OleAutoObj and "Object Text" Mathias Mamsch - Sun Aug 01 05:57:24 EDT 2010
You just need to use the "Copy" method on the shape object and do an olePaste(Attr_) to the attribute you want to import into. I don't know if there is a way without using the clipboard. You can convert an EmbeddedOleObject into an OleAutoObj but I think it is not possible the other way around. You can also use this approach to create OLE objects from scratch, for example an excel chart or a visio diagram. This is most useful for generating reports in DOORS.
OleAutoObj objEx = oleGetAutoObject("Excel.Application")
if (null objEx) { print "Please open Excel!"; halt }
OleAutoObj objSheet = null
oleGet(objEx, "ActiveSheet", objSheet)
if (null objEx) { print "Cannot find sheet. Please open a workbook!"; halt }
string s
oleGet(objSheet, "Name", s)
print "Worksheet Name: " s "\n"
OleAutoObj objShapes
oleGet(objSheet, "Shapes", objShapes)
if (null objShapes) { print "That is weird. No shapes collection found ..."; halt }
OleAutoArgs args = create()
put(args, 1)
OleAutoObj objShape
oleMethod(objShapes, "Item", args, objShape)
if (null objShape) { print "Cannot find Shape. Please insert a clipart to the active worksheet!"; halt }
oleGet(objShape, "Name", s)
print "Picture Name: " s "\n"
print oleMethod(objShape, "Copy")
olePaste (current Object)."Object Text"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
I am new in Door I want copy text from excel file and paste into Object Text of the current Object same like the following example Please give me DXL code |
Re: OleAutoObj and "Object Text" SystemAdmin - Fri Sep 09 05:41:47 EDT 2011 Looks like here is a call for you speech again. go for it. |
Re: OleAutoObj and "Object Text" OurGuest - Fri Sep 09 06:17:05 EDT 2011 https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14618865� https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14487281� By the way: I only very rarely answer requests which ask something like: "I have no idea of DXL, I need <DXL Program X>, please give me the code". If you want to learn DXL in this forum you can find a wealth of information. Try to start your own example, post it and we will improve it together. Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: OleAutoObj and "Object Text" I have modified the script in order to add a file chooser DBE in the data sheet GUI tab. The loaded configuration file is a list of modules to export to excel. Presently, I am able to create as many excel files as there are modules in my configuration file however, I would like to regroup all the seperate files in a single file. Also, if I try to select datasheet 4 or 5 (any number greater than 3. The script will not let me and re-routes my export to data sheet 1... I may have 50 modules to export and I want to create as many data sheets as modules in my configuration file) Any suggestions or leads will help in my understanding of this script. |